using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;
namespace Medianamik.Core.DAL.SubSonicDAL{
    /// <summary>
    /// Strongly-typed collection for the ModifiedNodeByPath class.
    /// </summary>
    [Serializable]
    public partial class ModifiedNodeByPathCollection : ReadOnlyList<ModifiedNodeByPath, ModifiedNodeByPathCollection>
    {        
        public ModifiedNodeByPathCollection() {}
    }
    /// <summary>
    /// This is  Read-only wrapper class for the vw_medianamik_ModifiedNodeByPath view.
    /// </summary>
    [Serializable]
    public partial class ModifiedNodeByPath : ReadOnlyRecord<ModifiedNodeByPath>, IReadOnlyRecord
    {
    
	    #region Default Settings
	    protected static void SetSQLProps() 
	    {
		    GetTableSchema();
	    }
	    #endregion
        #region Schema Accessor
	    public static TableSchema.Table Schema
        {
            get
            {
                if (BaseSchema == null)
                {
                    SetSQLProps();
                }
                return BaseSchema;
            }
        }
    	
        private static void GetTableSchema() 
        {
            if(!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("vw_medianamik_ModifiedNodeByPath", TableType.View, DataService.GetInstance("MedianamikProvider"));
                schema.Columns = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns
                
                TableSchema.TableColumn colvarNodeId = new TableSchema.TableColumn(schema);
                colvarNodeId.ColumnName = "NodeId";
                colvarNodeId.DataType = DbType.Guid;
                colvarNodeId.MaxLength = 0;
                colvarNodeId.AutoIncrement = false;
                colvarNodeId.IsNullable = false;
                colvarNodeId.IsPrimaryKey = false;
                colvarNodeId.IsForeignKey = false;
                colvarNodeId.IsReadOnly = false;
                
                schema.Columns.Add(colvarNodeId);
                
                TableSchema.TableColumn colvarParentNodeId = new TableSchema.TableColumn(schema);
                colvarParentNodeId.ColumnName = "ParentNodeId";
                colvarParentNodeId.DataType = DbType.Guid;
                colvarParentNodeId.MaxLength = 0;
                colvarParentNodeId.AutoIncrement = false;
                colvarParentNodeId.IsNullable = true;
                colvarParentNodeId.IsPrimaryKey = false;
                colvarParentNodeId.IsForeignKey = false;
                colvarParentNodeId.IsReadOnly = false;
                
                schema.Columns.Add(colvarParentNodeId);
                
                TableSchema.TableColumn colvarContentNodeId = new TableSchema.TableColumn(schema);
                colvarContentNodeId.ColumnName = "ContentNodeId";
                colvarContentNodeId.DataType = DbType.Guid;
                colvarContentNodeId.MaxLength = 0;
                colvarContentNodeId.AutoIncrement = false;
                colvarContentNodeId.IsNullable = true;
                colvarContentNodeId.IsPrimaryKey = false;
                colvarContentNodeId.IsForeignKey = false;
                colvarContentNodeId.IsReadOnly = false;
                
                schema.Columns.Add(colvarContentNodeId);
                
                TableSchema.TableColumn colvarTypeId = new TableSchema.TableColumn(schema);
                colvarTypeId.ColumnName = "TypeId";
                colvarTypeId.DataType = DbType.Guid;
                colvarTypeId.MaxLength = 0;
                colvarTypeId.AutoIncrement = false;
                colvarTypeId.IsNullable = false;
                colvarTypeId.IsPrimaryKey = false;
                colvarTypeId.IsForeignKey = false;
                colvarTypeId.IsReadOnly = false;
                
                schema.Columns.Add(colvarTypeId);
                
                TableSchema.TableColumn colvarCreatedOn = new TableSchema.TableColumn(schema);
                colvarCreatedOn.ColumnName = "CreatedOn";
                colvarCreatedOn.DataType = DbType.DateTime;
                colvarCreatedOn.MaxLength = 0;
                colvarCreatedOn.AutoIncrement = false;
                colvarCreatedOn.IsNullable = false;
                colvarCreatedOn.IsPrimaryKey = false;
                colvarCreatedOn.IsForeignKey = false;
                colvarCreatedOn.IsReadOnly = false;
                
                schema.Columns.Add(colvarCreatedOn);
                
                TableSchema.TableColumn colvarCreatedBy = new TableSchema.TableColumn(schema);
                colvarCreatedBy.ColumnName = "CreatedBy";
                colvarCreatedBy.DataType = DbType.String;
                colvarCreatedBy.MaxLength = 50;
                colvarCreatedBy.AutoIncrement = false;
                colvarCreatedBy.IsNullable = true;
                colvarCreatedBy.IsPrimaryKey = false;
                colvarCreatedBy.IsForeignKey = false;
                colvarCreatedBy.IsReadOnly = false;
                
                schema.Columns.Add(colvarCreatedBy);
                
                TableSchema.TableColumn colvarModifiedOn = new TableSchema.TableColumn(schema);
                colvarModifiedOn.ColumnName = "ModifiedOn";
                colvarModifiedOn.DataType = DbType.DateTime;
                colvarModifiedOn.MaxLength = 0;
                colvarModifiedOn.AutoIncrement = false;
                colvarModifiedOn.IsNullable = true;
                colvarModifiedOn.IsPrimaryKey = false;
                colvarModifiedOn.IsForeignKey = false;
                colvarModifiedOn.IsReadOnly = false;
                
                schema.Columns.Add(colvarModifiedOn);
                
                TableSchema.TableColumn colvarModifiedBy = new TableSchema.TableColumn(schema);
                colvarModifiedBy.ColumnName = "ModifiedBy";
                colvarModifiedBy.DataType = DbType.String;
                colvarModifiedBy.MaxLength = 50;
                colvarModifiedBy.AutoIncrement = false;
                colvarModifiedBy.IsNullable = true;
                colvarModifiedBy.IsPrimaryKey = false;
                colvarModifiedBy.IsForeignKey = false;
                colvarModifiedBy.IsReadOnly = false;
                
                schema.Columns.Add(colvarModifiedBy);
                
                TableSchema.TableColumn colvarFlags = new TableSchema.TableColumn(schema);
                colvarFlags.ColumnName = "Flags";
                colvarFlags.DataType = DbType.Int32;
                colvarFlags.MaxLength = 0;
                colvarFlags.AutoIncrement = false;
                colvarFlags.IsNullable = false;
                colvarFlags.IsPrimaryKey = false;
                colvarFlags.IsForeignKey = false;
                colvarFlags.IsReadOnly = false;
                
                schema.Columns.Add(colvarFlags);
                
                TableSchema.TableColumn colvarIsDeleted = new TableSchema.TableColumn(schema);
                colvarIsDeleted.ColumnName = "IsDeleted";
                colvarIsDeleted.DataType = DbType.Boolean;
                colvarIsDeleted.MaxLength = 0;
                colvarIsDeleted.AutoIncrement = false;
                colvarIsDeleted.IsNullable = false;
                colvarIsDeleted.IsPrimaryKey = false;
                colvarIsDeleted.IsForeignKey = false;
                colvarIsDeleted.IsReadOnly = false;
                
                schema.Columns.Add(colvarIsDeleted);
                
                TableSchema.TableColumn colvarPath = new TableSchema.TableColumn(schema);
                colvarPath.ColumnName = "Path";
                colvarPath.DataType = DbType.AnsiString;
                colvarPath.MaxLength = 500;
                colvarPath.AutoIncrement = false;
                colvarPath.IsNullable = false;
                colvarPath.IsPrimaryKey = false;
                colvarPath.IsForeignKey = false;
                colvarPath.IsReadOnly = false;
                
                schema.Columns.Add(colvarPath);
                
                TableSchema.TableColumn colvarDepth = new TableSchema.TableColumn(schema);
                colvarDepth.ColumnName = "Depth";
                colvarDepth.DataType = DbType.Int32;
                colvarDepth.MaxLength = 0;
                colvarDepth.AutoIncrement = false;
                colvarDepth.IsNullable = false;
                colvarDepth.IsPrimaryKey = false;
                colvarDepth.IsForeignKey = false;
                colvarDepth.IsReadOnly = false;
                
                schema.Columns.Add(colvarDepth);
                
                TableSchema.TableColumn colvarPosition = new TableSchema.TableColumn(schema);
                colvarPosition.ColumnName = "Position";
                colvarPosition.DataType = DbType.Int16;
                colvarPosition.MaxLength = 0;
                colvarPosition.AutoIncrement = false;
                colvarPosition.IsNullable = false;
                colvarPosition.IsPrimaryKey = false;
                colvarPosition.IsForeignKey = false;
                colvarPosition.IsReadOnly = false;
                
                schema.Columns.Add(colvarPosition);
                
                TableSchema.TableColumn colvarRoles = new TableSchema.TableColumn(schema);
                colvarRoles.ColumnName = "Roles";
                colvarRoles.DataType = DbType.String;
                colvarRoles.MaxLength = -1;
                colvarRoles.AutoIncrement = false;
                colvarRoles.IsNullable = true;
                colvarRoles.IsPrimaryKey = false;
                colvarRoles.IsForeignKey = false;
                colvarRoles.IsReadOnly = false;
                
                schema.Columns.Add(colvarRoles);
                
                TableSchema.TableColumn colvarBaseNodeId = new TableSchema.TableColumn(schema);
                colvarBaseNodeId.ColumnName = "BaseNodeId";
                colvarBaseNodeId.DataType = DbType.Guid;
                colvarBaseNodeId.MaxLength = 0;
                colvarBaseNodeId.AutoIncrement = false;
                colvarBaseNodeId.IsNullable = true;
                colvarBaseNodeId.IsPrimaryKey = false;
                colvarBaseNodeId.IsForeignKey = false;
                colvarBaseNodeId.IsReadOnly = false;
                
                schema.Columns.Add(colvarBaseNodeId);
                
                TableSchema.TableColumn colvarBaseTypeId = new TableSchema.TableColumn(schema);
                colvarBaseTypeId.ColumnName = "BaseTypeId";
                colvarBaseTypeId.DataType = DbType.Guid;
                colvarBaseTypeId.MaxLength = 0;
                colvarBaseTypeId.AutoIncrement = false;
                colvarBaseTypeId.IsNullable = true;
                colvarBaseTypeId.IsPrimaryKey = false;
                colvarBaseTypeId.IsForeignKey = false;
                colvarBaseTypeId.IsReadOnly = false;
                
                schema.Columns.Add(colvarBaseTypeId);
                
                TableSchema.TableColumn colvarCultureName = new TableSchema.TableColumn(schema);
                colvarCultureName.ColumnName = "CultureName";
                colvarCultureName.DataType = DbType.String;
                colvarCultureName.MaxLength = 10;
                colvarCultureName.AutoIncrement = false;
                colvarCultureName.IsNullable = false;
                colvarCultureName.IsPrimaryKey = false;
                colvarCultureName.IsForeignKey = false;
                colvarCultureName.IsReadOnly = false;
                
                schema.Columns.Add(colvarCultureName);
                
                
                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["MedianamikProvider"].AddSchema("vw_medianamik_ModifiedNodeByPath",schema);
            }
        }
        #endregion
        
        #region Query Accessor
	    public static Query CreateQuery()
	    {
		    return new Query(Schema);
	    }
	    #endregion
	    
	    #region .ctors
	    public ModifiedNodeByPath()
	    {
            SetSQLProps();
            SetDefaults();
            MarkNew();
        }
        public ModifiedNodeByPath(bool useDatabaseDefaults)
	    {
		    SetSQLProps();
		    if(useDatabaseDefaults)
		    {
				ForceDefaults();
			}
			MarkNew();
	    }
	    
	    public ModifiedNodeByPath(object keyID)
	    {
		    SetSQLProps();
		    LoadByKey(keyID);
	    }
    	 
	    public ModifiedNodeByPath(string columnName, object columnValue)
        {
            SetSQLProps();
            LoadByParam(columnName,columnValue);
        }
        
	    #endregion
	    
	    #region Props
	    
          
        [XmlAttribute("NodeId")]
        [Bindable(true)]
        public Guid NodeId 
	    {
		    get
		    {
			    return GetColumnValue<Guid>("NodeId");
		    }
            set 
		    {
			    SetColumnValue("NodeId", value);
            }
        }
	      
        [XmlAttribute("ParentNodeId")]
        [Bindable(true)]
        public Guid? ParentNodeId 
	    {
		    get
		    {
			    return GetColumnValue<Guid?>("ParentNodeId");
		    }
            set 
		    {
			    SetColumnValue("ParentNodeId", value);
            }
        }
	      
        [XmlAttribute("ContentNodeId")]
        [Bindable(true)]
        public Guid? ContentNodeId 
	    {
		    get
		    {
			    return GetColumnValue<Guid?>("ContentNodeId");
		    }
            set 
		    {
			    SetColumnValue("ContentNodeId", value);
            }
        }
	      
        [XmlAttribute("TypeId")]
        [Bindable(true)]
        public Guid TypeId 
	    {
		    get
		    {
			    return GetColumnValue<Guid>("TypeId");
		    }
            set 
		    {
			    SetColumnValue("TypeId", value);
            }
        }
	      
        [XmlAttribute("CreatedOn")]
        [Bindable(true)]
        public DateTime CreatedOn 
	    {
		    get
		    {
			    return GetColumnValue<DateTime>("CreatedOn");
		    }
            set 
		    {
			    SetColumnValue("CreatedOn", value);
            }
        }
	      
        [XmlAttribute("CreatedBy")]
        [Bindable(true)]
        public string CreatedBy 
	    {
		    get
		    {
			    return GetColumnValue<string>("CreatedBy");
		    }
            set 
		    {
			    SetColumnValue("CreatedBy", value);
            }
        }
	      
        [XmlAttribute("ModifiedOn")]
        [Bindable(true)]
        public DateTime? ModifiedOn 
	    {
		    get
		    {
			    return GetColumnValue<DateTime?>("ModifiedOn");
		    }
            set 
		    {
			    SetColumnValue("ModifiedOn", value);
            }
        }
	      
        [XmlAttribute("ModifiedBy")]
        [Bindable(true)]
        public string ModifiedBy 
	    {
		    get
		    {
			    return GetColumnValue<string>("ModifiedBy");
		    }
            set 
		    {
			    SetColumnValue("ModifiedBy", value);
            }
        }
	      
        [XmlAttribute("Flags")]
        [Bindable(true)]
        public int Flags 
	    {
		    get
		    {
			    return GetColumnValue<int>("Flags");
		    }
            set 
		    {
			    SetColumnValue("Flags", value);
            }
        }
	      
        [XmlAttribute("IsDeleted")]
        [Bindable(true)]
        public bool IsDeleted 
	    {
		    get
		    {
			    return GetColumnValue<bool>("IsDeleted");
		    }
            set 
		    {
			    SetColumnValue("IsDeleted", value);
            }
        }
	      
        [XmlAttribute("Path")]
        [Bindable(true)]
        public string Path 
	    {
		    get
		    {
			    return GetColumnValue<string>("Path");
		    }
            set 
		    {
			    SetColumnValue("Path", value);
            }
        }
	      
        [XmlAttribute("Depth")]
        [Bindable(true)]
        public int Depth 
	    {
		    get
		    {
			    return GetColumnValue<int>("Depth");
		    }
            set 
		    {
			    SetColumnValue("Depth", value);
            }
        }
	      
        [XmlAttribute("Position")]
        [Bindable(true)]
        public short Position 
	    {
		    get
		    {
			    return GetColumnValue<short>("Position");
		    }
            set 
		    {
			    SetColumnValue("Position", value);
            }
        }
	      
        [XmlAttribute("Roles")]
        [Bindable(true)]
        public string Roles 
	    {
		    get
		    {
			    return GetColumnValue<string>("Roles");
		    }
            set 
		    {
			    SetColumnValue("Roles", value);
            }
        }
	      
        [XmlAttribute("BaseNodeId")]
        [Bindable(true)]
        public Guid? BaseNodeId 
	    {
		    get
		    {
			    return GetColumnValue<Guid?>("BaseNodeId");
		    }
            set 
		    {
			    SetColumnValue("BaseNodeId", value);
            }
        }
	      
        [XmlAttribute("BaseTypeId")]
        [Bindable(true)]
        public Guid? BaseTypeId 
	    {
		    get
		    {
			    return GetColumnValue<Guid?>("BaseTypeId");
		    }
            set 
		    {
			    SetColumnValue("BaseTypeId", value);
            }
        }
	      
        [XmlAttribute("CultureName")]
        [Bindable(true)]
        public string CultureName 
	    {
		    get
		    {
			    return GetColumnValue<string>("CultureName");
		    }
            set 
		    {
			    SetColumnValue("CultureName", value);
            }
        }
	    
	    #endregion
    
	    #region Columns Struct
	    public struct Columns
	    {
		    
		    
            public static string NodeId = @"NodeId";
            
            public static string ParentNodeId = @"ParentNodeId";
            
            public static string ContentNodeId = @"ContentNodeId";
            
            public static string TypeId = @"TypeId";
            
            public static string CreatedOn = @"CreatedOn";
            
            public static string CreatedBy = @"CreatedBy";
            
            public static string ModifiedOn = @"ModifiedOn";
            
            public static string ModifiedBy = @"ModifiedBy";
            
            public static string Flags = @"Flags";
            
            public static string IsDeleted = @"IsDeleted";
            
            public static string Path = @"Path";
            
            public static string Depth = @"Depth";
            
            public static string Position = @"Position";
            
            public static string Roles = @"Roles";
            
            public static string BaseNodeId = @"BaseNodeId";
            
            public static string BaseTypeId = @"BaseTypeId";
            
            public static string CultureName = @"CultureName";
            
	    }
	    #endregion
	    
	    
	    #region IAbstractRecord Members
        public new CT GetColumnValue<CT>(string columnName) {
            return base.GetColumnValue<CT>(columnName);
        }
        public object GetColumnValue(string columnName) {
            return base.GetColumnValue<object>(columnName);
        }
        #endregion
	    
    }
}
